<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="box">
      <span class="front">front</span>
      <span class="back">back</span>
      <span class="left">left</span>
      <span class="right">right</span>
      <span class="top">top</span>
      <span class="bottom">bottom</span>
    </div>

    <style>
      body {
        /* perspective: 500px; */
        perspective: 500px;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
      }
      .box {
        width: 100px;
        height: 100px;
        /* background-color: rgba(241, 160, 10, 0.555); */
        margin: 100px;
        position: relative;

        /* border: 1px solid black; */

        transform-style: preserve-3d;
        /*perspective: 500px; */

        transition: all 8s linear;
      }

      .box:hover {
        transform: rotateX(-15deg) rotateY(360deg);
      }
      .box span {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        background-color: rgba(94, 255, 0, 0.459);
      }
      .box span.front {
        transform: translateZ(50px);
        background-color: rgba(0, 0, 255, 0.582);
      }

      .box span.back {
        transform: rotateY(180deg) translateZ(50px);
        background-color: rgba(165, 42, 42, 0.589);
      }

      .box span.left {
        transform: rotateY(-90deg) translateZ(50px);
        background-color: rgba(235, 10, 160, 0.589);
      }

      .box span.right {
        transform: rotateY(90deg) translateZ(50px);
        background-color: rgba(235, 10, 160, 0.589);
      }

      .box span.top {
        transform: rotateX(90deg) translateZ(50px);
        background-color: rgba(10, 235, 78, 0.589);
      }

      .box span.bottom {
        transform: rotateX(-90deg) translateZ(50px);
        background-color: rgba(10, 235, 78, 0.589);
      }
    </style>
  </body>
</html>
